// Copyright (C) ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
//
// $Id: test_utility.cpp 226 2008-09-12 17:56:02Z heavyzheng $
//

#include <zzheng/test_utility.hpp>
#include <fstream>
#include <string>

namespace zzheng {
namespace test {

    ////////////////////////////////////////////////////////////////////////////////////////////////
    // csv_record
    //

    csv_record::csv_record(): buffer_(), empty_(true) {
        // Do nothing.
    }

    void csv_record::clear() {
        buffer_.clear();
        empty_ = true;
    }

    const std::string& csv_record::str() const {
        return buffer_;
    }

    csv_record& csv_record::add_field_(const std::string& field) {
        if (!empty_) {
            buffer_.append(",");
        }
        buffer_.append(boost::lexical_cast<std::string>(field));
        empty_ = false;
        return *this;
    }

} // namespace zzheng::test
} // namespace zzheng

